#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QMimeData>
#include <QShortcut>
#include <QPainter>
#include <QPen>
#include "qwidget.h"
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
      widget = new mywidget(this);
      ui->setupUi(this);
      widget->setGeometry(0,0,ui->frame->width(),ui->frame->height());
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
   QParallelAnimationGroup *group=new QParallelAnimationGroup(this);
   QPropertyAnimation *aniPos=new QPropertyAnimation(widget,"imagepos",this);
   aniPos->setStartValue(QPoint(0,0));
   aniPos->setEndValue((QPoint(200,200)));
   aniPos->setDuration(2000);
   aniPos->setEasingCurve(QEasingCurve::InOutBack);
   QSequentialAnimationGroup *sub1=new QSequentialAnimationGroup(group);
   sub1->addPause(200);
   sub1->addAnimation(aniPos);

   QPropertyAnimation *aniScale=new QPropertyAnimation(widget,"imagescale",this);
   aniScale->setStartValue(QSize(30,30));
   aniScale->setEndValue(QSize(160,160));
   aniScale->setDuration(1000);
   aniScale->setEasingCurve(QEasingCurve::InOutBack);
   QSequentialAnimationGroup *sub2=new QSequentialAnimationGroup(group);
   sub2->addPause(500);
   sub2->addAnimation(aniScale);

   group->start();

}

